package com.yl.chainStore.common.enums

import com.baomidou.mybatisplus.annotation.EnumValue
import com.fasterxml.jackson.annotation.JsonValue

enum class Status(@EnumValue val code: Int, @JsonValue val show: String) {

    SUBSCRIBE(100,"预约"),

    NEW_ADD(150,"新建"),

    STAGING(200,"暂存"),

    NON_ARRIVAL(240,"未到"),

    WAITING(280,"等待中"),

    /**
     * 待处理 (之后不能修改内容)
     */
    WAIT_AUDIT(300, "待处理"),


    WAIT_PAY(310, "待付款"),

    /**
     * 暂停
     */
    PUSH(350,"待复诊"),

    ONGOING(400,"处理中"),

    MAKING(401,"制作中"),

    PAYING(410, "欠款"),

    IN_THE_TREATMENT(450,"治疗中"),

    COMPLETE(1000, "完成"),
    COMPLETE_TREATMENT(1001, "治疗完成"),
    MAKE_COMPLETE(1002,"制作完成"),

    ORDER_PAY_END(1100,"已结账"),

    END(1200,"结束"),
    MAKE_END(1202,"已完成"),

    LEAVE(1220,"已离店"),


    //后面算失败
    OUT_TIME(1250,"过期"),

    /**
     * 未通过（并不能修改）
     */
    NO_PASS(1300,"未通过"),

    SCRAP(1500, "报废"),

    CANCEL(1501,"取消"),


    //人物状态
    FREE(3000,"空闲"),
    CONSULTING(3050,"咨询中"),
    IRREDUCIBLE(3100,"不可约"),
    ALL(3150,"全部"),

    //开关
    OPEN(3200,"开启"),
    CLOSE(3250,"关闭"),

    NORMAL(3300,"正常"),


    /**
     * 未知
     */
    UNKNOWN(-1, "未知");

    companion object {
        fun getEnum(d: Int?): Status {
            return values().find { it.code == (d ?: return UNKNOWN) } ?: UNKNOWN
        }
        fun getEnum(d: String?): Status {
            return values().find { it.show == (d ?: return UNKNOWN) } ?: UNKNOWN
        }
    }

    fun getMap():MutableMap<String,Any>{
        val map = mutableMapOf<String,Any>()
        map["id"] = this.show
        map["name"] = this.show
        return map
    }
}


